<!DOCTYPE html>
<html> 
    <head>       
    <style>
pre {
    display: block;
    font-family: monospace;
    white-space: pre;
    margin: 1em 0;
    color:maroon;
    background-color: #DDDDDD;
}

li {
  margin: 12px 0;
}

img {
  display:block;
  max-width: 100%;
}
</style>

    <title>EPIMODELS</title>
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script>
        var prevSelection = "tab1";
        $("#navbar ul li").live("click",function(){
            var newSelection = $(this).children("a").attr("data-tab-class");
            $("."+prevSelection).addClass("ui-screen-hidden");
            $("."+newSelection).removeClass("ui-screen-hidden");
            prevSelection = newSelection;
        });
    </script>
    <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
    <style>
        .tab-content{
            width:100%;
            height:100%;
            background-color:white;
            border-bottom-left-radius:0.5em;
            border-bottom-right-radius:0.5em;
        }
        .tab-content>div{
            padding:15px;
        }                    

    </style>
    </head> 

    <body> 
        <div data-role="page" data-theme="b">

        <div data-role="header" data-theme="b">
        <h1>EPIMODELS - Stata module for epidemiological models and simulations</h1>
        </div><!-- /header -->

        <div data-role="content">   
            <div data-role="navbar" id="navbar">
                <ul>
                    <li><a href="#" class="ui-btn-active" data-tab-class="tab1">Description</a></li>
                    <li><a href="#" data-tab-class="tab2">Installation</a></li>
                    <li><a href="#" data-tab-class="tab3">Usage</a></li>
                    <li><a href="#" data-tab-class="tab4">Documentation and Resources</a></li>
                    <li><a href="#" data-tab-class="tab5">Author</a></li>
                </ul>
            </div>

<div class="tab-content">

<div class="tab1">
<H2>Description</H2>
<P><B>EPIMODELS</B> simulates SIR and SEIR epidemiological models.</P>
<A href="images/sir_model_graph.png" target="_new"><IMG src="images/sir_model_graph.png" width=428></A>
<P><B>EPIMODELS</B> provides interactive dialogs, which can be of an advantage for
novice users, and also can be called from the users' do and ado-files for massive
or repetitive jobs.</P>
<IMG src="images/seir_model_dialog.png">
</div>


<div class="tab2 ui-screen-hidden">

<H2>Installation</H2>
<P>Stata 16.0 or newer is required for <B>epimodels</B>.</P>
<P>To install <B>epimodels</B> type literally the following in Stata's command prompt:</P>
<PRE>

ssc install epimodels

</PRE>
<H2>Update</H2>
<P>To update <B>epimodels</B> (after it is installed) type literally the following in Stata's command prompt:</P>
<PRE>

ado update epimodels, update

</PRE>
<H2>Uninstallation</H2>
<P>To uninstall <B>epimodels</B> type literally the following in Stata's command prompt:</P>
<PRE>

ssc uninstall epimodels

</PRE>
</div>





<div class="tab3 ui-screen-hidden">

<H2>Usage</H2>

<P>To call the SIR-model type the following in the Stata command line:</P>
<PRE>
db epi_sir
</PRE>


<P>To call the SEIR-model type the following in the Stata command line:</P>
<PRE>
db epi_seir
</PRE>


<P>Both models generate new variables storing the model data. Typically it 
makes sense to clear memory before calling the model dialog (or specify 
option <I>clear</I> in the command line).</P>


<H2>Gallery and Examples</H2>
<div data-role="collapsible">
<h4>Black-and-white chart</h4>
<p><B>epimodels</B> produces output using standard Stata's graphing 
commands. To produce output optimized for the black-and-white publications, 
specify a corresponding scheme, e.g. <I>s2monochrome</I>. This will cause all 
colors to be turned to shades of gray, and various line patterns applied
to differentiate between the lines.</p>
    <CENTER><IMG src="images/sir_s2mono.svg"></CENTER>
    <PRE> epi_sir, days(100) clear /// 
          beta(0.5) gamma(0.33333) ///
          susceptible(60.4e+06) infected(100) ///
          scheme("s2mono") scale(0.75)</PRE>
<P>N.B. the value 60.4e+06 is equivalent of 60.4mln (60,400,000) in Stata's notation.</P>
</div>

<div data-role="collapsible">
<h4>Rotating labels for axes scales</h4>
<p>We can easily adjust the direction of labels by controlling the angle of labels at 
each axis, note the <I>angle(#)</I> option:</p>
    <CENTER><IMG src="images/sir_rotated.svg"></CENTER>
    <PRE> epi_sir, days(100) day0(2020-02-01) clear ///
          beta(0.5) gamma(0.33333) /// 
          susceptible(60.4e+06) infected(100) ///
          xlabel(,angle(33)) ylabel(,angle(0)) ///
          scale(0.75) graphregion(color(white))</PRE>
<P>N.B. the value 60.4e+06 is equivalent of 60.4mln (60,400,000) in Stata's notation.</P>
</div>


<div data-role="collapsible">
<h4>Peak detection</h4>
<p>Model charts are often supplemented with the illustration of the peak of infected.</p>
    <CENTER><IMG src="images/sir_peak.svg"></CENTER>
    <PRE> do "https://raw.githubusercontent.com/radyakin/epimodels/master/demo/demo2.do"</PRE>
<P>The strategy in this 
<A href="https://raw.githubusercontent.com/radyakin/epimodels/master/demo/demo2.do">
example</A> is to perform the first model run without displaying any results,
solely to obtain the peak values, then perform a second run already plotting the results and
overlaying with the peak illustration.</P>
<P>One can equally run a model with or without the graphing, then build another graph with 
peak illustration by own code.</P>
</div>

<div data-role="collapsible">
<h4>Effect of parameter &beta; in the SIR model</h4>
<p>As illustrated in the following chart, higher values of &beta; correspond to higher 
peaks of the infected group, holding other parameters constant.</p>
    <CENTER><IMG src="images/sir_beta.svg"></CENTER>
    <PRE> do "https://raw.githubusercontent.com/radyakin/epimodels/master/demo/demo3.do"</PRE>
<P>In this <A href="https://raw.githubusercontent.com/radyakin/epimodels/master/demo/demo3.do">example</A> 
we run multiple simulations of the same model varying just one parameter (&beta;) and then
plotting the results all together at the same chart.</P>
</div>

<div data-role="collapsible">
<h4>Epidemics profile</h4>
<p>Given that the overall population is fixed, plotting the size of each group 
in a stacked form helps understand the development of epidemics.</p>
    <CENTER><IMG src="images/demo4.svg"></CENTER>
    <PRE> do "https://raw.githubusercontent.com/radyakin/epimodels/master/demo/demo4.do"</PRE>
<P>The peak value of infected can also be automatically plotted, as in this 
<A href="https://raw.githubusercontent.com/radyakin/epimodels/master/demo/demo4.do">example</A>.</P>
</div>

<div data-role="collapsible">
<h4>Social distancing policy simulation</h4>
<p>We can simulate the effect of the policy of social distancing, here reducing 
the intensity of contacts from 0.9 to 0.3.</p>
    <CENTER><IMG src="images/demo5.svg"></CENTER>
    <PRE> do "https://raw.githubusercontent.com/radyakin/epimodels/master/demo/demo5.do"</PRE>
<P>The strategy here is to do a simulation with a base scenario, then do a 
second simulation picking from a mid-point of the simulation, but continuing 
with values of parameters modified by the policy. The full code is shown in this 
<A href="https://raw.githubusercontent.com/radyakin/epimodels/master/demo/demo5.do">example</A>.</P>
</div>


<div data-role="collapsible">
<h4>Sensitivity of key indicators</h4>
<p>In this example we look at how the day of the peak infected and the maximum 
number of infected are sensitive to the value of the parameter beta.</p>
    <CENTER><IMG src="images/demo6_sir_sensitivity_beta.svg"></CENTER>
    <PRE> do "https://raw.githubusercontent.com/radyakin/epimodels/master/demo/demo6.do"</PRE>
<P>The strategy here is to do a simulation for a given value of gamma (0.25 in this example)
and varying beta, accumulating the critical results returned by the model after every run. Then
plotting just those accumulated results. The full code is shown in this 
<A href="https://raw.githubusercontent.com/radyakin/epimodels/master/demo/demo6.do">example</A>.</P>
<P>Note also that while beta remains smaller than gamma, the highest number of infected is the initial
number (10), and so the day of the peak is 0.</P>
</div>


</div>





<div class="tab4 ui-screen-hidden">

    <H2>Documentation and Resources</H2>
    <P>Epimodels is available for download from RePEc 
	<A href="https://ideas.repec.org/c/boc/bocode/s458764.html">Ideas</A> and 
	RePEc <A href="https://econpapers.repec.org/software/bocbocode/s458764.htm">EconPapers</A>.</P>
    <P>	Announcement of the epimodels was posted to <A href="https://www.statalist.org/forums/forum/general-stata-discussion/general/1547096">StataList</A> on April 15, 2020 and to the <A href="https://blogs.worldbank.org/opendata/covid-19-new-epimodels-stata-package-bridges-gap-between-epidemiological-and-economic">World Bank Data Blog</A> on May 05, 2020.</P>
    <P>Additional information is available in the following vignettes:</P>
    <UL>
    <LI><a href="sir_model.pdf" target="_blank">
	  COVID-19. Modelling the Epidemic. The SIR Model.</a></LI>
    <LI><a href="seir_model.pdf" target="_blank">
	  COVID-19. Modelling the Epidemic. The SEIR Model.</a></LI>
    <LI><a href="epimodels.pdf" target="_blank">
	  Equations and model</a></LI>
    </UL>

</div>

    <div class="tab5 ui-screen-hidden">
	    <H2>Author</H2>
	    <P><B>EPIMODELS</B> was written by
	    <A href="https://econpapers.repec.org/RAS/pra699.htm" target="_new">Sergiy Radyakin</A> and 
	    <A href="https://econpapers.repec.org/RAS/pve105.htm" target="_new">Paolo Verme</A>.</P>
    </div>

            </div>
        </div><!-- /content -->

        </div><!-- /page -->
    </body>
</html>
